<?php
    /**
    *
    */
    class Core_AdminRole extends Core_AdminController
    {
        function __construct()
        {
            parent::__construct();
            $names = explode('_', get_class($this));
            if ($names[0] === 'Ex') {
                $names[0] = $names[1];
            }
            $module = strtolower($names[0]);
            $role = str_replace('admin', '', strtolower($names[1]));
            $modules = $_SESSION['admin']['modules'];
            if (empty($modules[$module][$role])) {
                sfresponse(false, '无权访问！');
            }
            $this->view->setRole($role);
        }
    }